We assume that the coordinates XX, YY and ZZ are adjacent in memory, which allows us to define an automatic conversion to a C-array. This is not guaranteed by the C-standard, but it usually works though...
|
|
| Vector3 () |
| | by default, coordinates are not initialized
|
| |
|
| Vector3 (const real x, const real y, const real z) |
| | construct from values
|
| |
|
| Vector3 (const real v[]) |
| | construct from address
|
| |
|
| Vector3 (const real v[], const int &d) |
| | construct from array of size d
|
| |
|
| ~Vector3 () |
| | destructor (is not-virtual: do not derive from this class)
|
| |
|
| operator real * () |
| | implicit conversion to a modifiable real[] array
|
| |
|
| operator const real * () const |
| | implicit conversion to a const real[] array
|
| |
|
real * | addr () |
| | conversion to a 'real array'
|
| |
|
real & | operator[] (const unsigned ii) |
| | modifiable access to individual coordinates
|
| |
|
void | get (const real b[]) |
| | replace coordinates by the ones provided
|
| |
|
void | get (const real v[], const int &d) |
| | copy coordinates from array of size d
|
| |
|
void | put (real b[]) const |
| | copy coordinates to given array
|
| |
|
void | addTo (real b[]) const |
| | add to given array
|
| |
|
void | addFrom (real b[]) |
| | change coordinates by adding given array
|
| |
|
void | subTo (real b[]) const |
| | subtract to given array
|
| |
|
void | subFrom (real b[]) |
| | change coordinates by subtracting given array
|
| |
|
void | set (const real x, const real y, const real z) |
| | change coordinates
|
| |
|
void | oppose () |
| | change signs of all coordinates
|
| |
|
real | normSqr () const |
| | the square of the standard norm
|
| |
|
real | norm () const |
| | the standard norm = sqrt(x^2+y^2+z^2)
|
| |
|
real | normXY () const |
| | the 2D norm = sqrt(x^2+y^2)
|
| |
|
real | normXZ () const |
| | the 2D norm = sqrt(x^2+z^2)
|
| |
|
real | normYZ () const |
| | the 2D norm = sqrt(y^2+z^2)
|
| |
|
real | distanceSqr (Vector3 const &a) const |
| | square of the distance to other point == (a-this).normSqr()
|
| |
|
real | distance (Vector3 const &a) const |
| | distance to other point == (a-this).norm()
|
| |
|
real | minimum () const |
| | returns min(x, y, z)
|
| |
|
real | maximum () const |
| | returns max(x, y, z)
|
| |
|
real | norm_inf () const |
| | the infinite norm = max(|x|, |y|, |z|)
|
| |
|
void | normalize (const real n=1.0) |
| | normalize to norm=n
|
| |
|
const Vector3 | normalized (const real n=1.0) const |
| | returns the colinear vector of norm=n
|
| |
|
const Vector3 | orthogonal () const |
| | returns a perpendicular vector, of comparable but unspecified norm
|
| |
|
const Vector3 | orthogonal (const real n) const |
| | returns a perpendicular vector, of norm n
|
| |
|
void | getEulerAngles (real angles[]) const |
| | get the Euler angles
|
| |
|
void | setFromEulerAngles (const real angles[]) |
| | set from Euler angles
|
| |
|
const Vector3 | e_mul (const real b[]) const |
| | returns the element-by-element product
|
| |
|
const Vector3 | e_div (const real b[]) const |
| | returns the element-by-element division
|
| |
|
void | operator+= (Vector3 const &b) |
| | addition of another vector b
|
| |
|
void | operator-= (Vector3 const &b) |
| | subtraction of another vector b
|
| |
|
void | operator*= (const real b) |
| | multiplication by a scalar
|
| |
|
void | operator/= (const real b) |
| | division by a scalar
|
| |
|
std::string | str () const |
| | conversion to a string
|
| |
|
void | print (FILE *out=stdout) const |
| | print to a file
|
| |
|
void | pprint (FILE *out=stdout) const |
| | print to a file, surrounded by parenthesis
|
| |
|
void | println (FILE *out=stdout) const |
| | print, followed by a new line
|
| |
|
void | addRand (real s) |
| | add a random component in [-s, s] to each coordinate
|
| |
|
const Vector3 | randPerp (real n) const |
| | a vector of norm n, orthogonal to *this, chosen randomly and uniformly
|
| |